package completablefuture.demo2;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import lombok.experimental.Accessors;

import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;

/**
 * @author : ZhuQi
 * @version : 时间:2022/9/5 22:15 版本:
 * @description : 网上商城
 */
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class OnlineMall {

    /**
     * 商城明
     */
    private String mallName;

    /**
     * 商品名
     */
    private String productName;

    /**
     * 查询商品以及价格
     * @return
     */
    @SneakyThrows
    public String queryProduct(){
        TimeUnit.SECONDS.sleep(1L);
        String str = productName + " in "
                + mallName + " price "
                + (ThreadLocalRandom.current().nextDouble(20) + mallName.charAt(0));
        return str;
    }
}
